package com.ocom.emqx.controller;

import com.ocom.common.constant.EmqxUrl;
import com.ocom.common.request.emqx.YhDeviceWorkStatusRequest;
import com.ocom.common.request.emqx.YhMqtt0606Request;
import com.ocom.common.request.emqx.YhMqtt0607Request;
import com.ocom.common.request.emqx.YhStatusRequest;
import com.ocom.common.resp.Result;
import com.ocom.common.utils.ResultUtil;
import com.ocom.emqx.service.WashingMachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class YhMqttController {

    @Autowired
    private WashingMachineService washingMachineService;


    @PostMapping(EmqxUrl.URL_yhMqtt0607)
    public Result yhMqtt0607(@RequestBody YhMqtt0607Request request){
        return ResultUtil.success(this.washingMachineService.yHMqtt0607(request));
    }

    @PostMapping(EmqxUrl.URL_yhMqtt0606)
    public Result yhMqtt0606(@RequestBody YhMqtt0606Request request){
        return ResultUtil.success(this.washingMachineService.yHMqtt0606(request));
    }

    @PostMapping(EmqxUrl.URL_yHStatus)
    public Result yHStatus(@RequestBody YhStatusRequest request){
        return ResultUtil.success(this.washingMachineService.yHStatus(request.getStatus(), request.getSubRun()));
    }

    @PostMapping(EmqxUrl.URL_yhDeviceWorkStatus)
    public Result yhDeviceWorkStatus(@RequestBody YhDeviceWorkStatusRequest request){
        return ResultUtil.success(this.washingMachineService.yhDeviceWorkStatus(request.getStatus(), request.getSubRun(), request.getSubNum()));
    }


}
